home *** CD-ROM | disk | FTP | other *** search
- ' IFF Map reader test program
- ' This is part of a larger program that I am working on
- ' Therefore, the shape table contains a lot of items not used
- 'in this demo. Be sure to get the keys. You need them for the doors.
- Set Buffer 10 : Rem more if needed
- Dim OBJECTS(39),OBJECT$(39),FLAG(39),KEY(10)
- Dim D$(4),MAP(4,2),M(9),N(4)
- Goto INFORMATION
-
- ' gosubs here for quick program access
-
- MICE1:
- 'Keyboard and mouse input
- K$="" : Clear Key
- While K$=""
- K$=Inkey$
- If Mouse Key<>0 Then K$="1"
- Wend
- While Mouse Key<>0 : Wend
- XM=X Mouse-128 : YM=Y Mouse-50 : MC=Point(XM,YM)
- TEMP=0 : NS=N : Goto ENTRY1
-
- ENTRY:
- Curs On : Input "Your response ";TEMP$
- TEMP$=Lower$(TEMP$) : Curs Off
- 'goto entry1
-
- ENTRY1:
- CLOCK=CLOCK+1 : FLAG=0 : Rem loop flag
- 'goto cleartext
-
- CLEARTEXT:
- For X1=20 To 22
- Locate 0,X1 : Print " "
- Next
- Locate 0,23 : Print " "
- Locate 0,20
- Return
-
- ANYKEY:
- Print "any key to continue."
- K$=""
- While K$=""
- K$=Inkey$
- If Mouse Key<>0 Then K$="1"
- Wend
- While Mouse Key<>0 : Wend : Return
-
- MAP:
- ' display the game map
- Screen To Front 2 : Screen 2
- Change Mouse 2 :
- K$=""
- While K$=""
- X Mouse=128+X : Y Mouse=50+Y : K$=Inkey$
- Wait 20 : Hide : Wait 20 : Show
- If Mouse Key<>0 Then K$="1"
- Wend
- Change Mouse 1
- Screen To Front 1 : Screen 1
- Return :Rem Returns back to MAIN
-
- LANDSCAPES:
- Bob Off : Wait Vbl
- 'read map
- Screen 2
- If N=1
- For YY=0 To 4 : For XX=0 To 2
- MAP(YY,XX)=Point(X+XX-1,Y+YY-4)
- Next : Next
- Else If N=2
- For YY=0 To 4 : For XX=0 To 2
- MAP(YY,XX)=Point(X-YY+4,Y+XX-1)
- Next : Next
- Else If N=3
- For YY=0 To 4 : For XX=0 To 2
- MAP(YY,XX)=Point(X-XX+1,Y-YY+4)
- Next : Next
- Else If N=4
- For YY=0 To 4 : For XX=0 To 2
- MAP(YY,XX)=Point(X+YY-4,Y-XX+1)
- Next : Next
- End If
- Plot X,Y,7
- ROOM=X*Y
- If MAP(4,1)=2 Then FLAG(19)=ROOM
- 'Generate 3-D display from shape table
- If MAP(1,0)=0 Then M(3)=43 Else M(3)=57
- If MAP(0,1)=0
- M(4)=58 : M(5)=58
- Else
- M(4)=44 : M(5)=44
- End If
- If MAP(1,2)<2 Then M(6)=43 Else M(6)=57
- If MAP(2,0)<2 Then M(2)=42 Else M(2)=54
- If MAP(1,1)<2 Then M(3)=55 : M(4)=56 : M(5)=56 : M(6)=55
- If MAP(2,2)<2 Then M(7)=42 Else M(7)=54
- If MAP(3,0)<2 Then M(1)=41 Else M(1)=50
- If MAP(2,1)<2 Then M(2)=51 : M(3)=52 : M(4)=53 : M(5)=53 : M(6)=52 : M(7)=51
- If MAP(3,2)<2 Then M(8)=41 Else M(8)=50
- If MAP(4,0)<2 Then M(0)=40 Else M(0)=45
- If MAP(3,1)<2 Then M(1)=46 : M(2)=47 : M(3)=48 : M(4)=49 : M(5)=49 : M(6)=48 : M(7)=47 : M(8)=46
- If MAP(4,2)<2 Then M(9)=40 Else M(9)=45
- 'display3-D from shape table
- Screen 1
- For XX=0 To 4
- Paste Bob XX*32,0,M(XX)
- Next
- 'make shape table draw reverse images
- For XX=5 To 9
- Paste Bob XX*32,0,Hrev(M(XX))
- Next
- ' Display door
- If MAP(1,1)=1 and MAP(2,1)>1 and MAP(3,1)>1 Then Paste Bob 140,100,35
- If MAP(2,1)=1 and MAP(3,1)>1 Then Paste Bob 130,90,36
- If MAP(3,1)=1 Then Paste Bob 120,80,37
- 'test objects display values
- Locate 16,0
- Print MAP(3,0);" ";MAP(3,1);" ";MAP(3,2);" "
- Locate 16,1
- Print MAP(4,0);" ";MAP(4,1);" ";MAP(4,2);" "
- If MAP(3,1)=6 and ROBOFLAG>0
- ROBOCOP=1 : ROBOFLAG=ROBOFLAG+1
- Else If ROBOFLAG>0
- ROBOCOP=0 : ROBOFLAG=1
- End If
- Paste Bob 10,10,1 : Rem place marker for mouse commands
- 'Display objects if available in location
- For X1=4 To 34
- If ROOM=FLAG(X1) Then Bob X1,200,100,X1
- Next
- If ROBOCOP=1 Then Bob 1,120,40,2
- Wait Vbl : ABKFLAG=0 : Rem display bobs now
- Gosub CLEARTEXT : Print "FACING ";D$(N)
- Return
-
- MAPP:
- 'Move in the maze
- NS=0
- If N=1
- Y=Y-1
- Else If N=2
- X=X+1
- Else If N=3
- Y=Y+1
- Else
- X=X-1
- End If
- Return
-
- MICE:
- If ROBOCOP=1
- Locate 0,20 : Print "Stay where you are."
- Print "You will not be harmed."
- Wait 60
- End If
- Gosub MICE1
- 'Read Command Graphics or keyboard
- If XM>22 and XM<29 and YM>9 and YM<17 or K$="f"
- TEMP=1
- If MAP(3,1)>1
- Print "You travel forward." : Gosub MAPP
- Else If MAP(3,1)=1 and KEYFLAG=1
- Print "You go through the door" : Gosub MAPP : KEYFLAG=0
- Else
- Print "You can't go in that direction."
- End If
- Else If XM>14 and XM<21 and YM>19 and YM<24 or K$="l"
- TEMP=2 : N=N-1 : Print "You turn to the left"
- Else If XM>29 and XM<37 and YM>17 and YM<24 or K$="r"
- TEMP=3 : N=N+1 : Print "You turn to the right."
- End If
- If N>4 Then N=1
- If N<1 Then N=4
- If XM>9 and XM<22 and YM>9 and YM<17 or K$="c" Then TEMP=5 : Rem up
- If XM>9 and XM<33 and YM>31 and YM<39 or K$="d" Then TEMP=6 : Rem down
- If XM>9 and XM<29 and YM>40 and YM<48 or K$="g" Then TEMP=7 : Rem get
- If XM>9 and XM<29 and YM>48 and YM<56 or K$="p" Then TEMP=8 : Rem put
- If XM>9 and XM<29 and YM>56 and YM<64 or K$="u" Then TEMP=9 : Rem use
- 'This line altered for demo
- If XM>9 and XM<33 and YM>64 and YM<72 or K$="m" Then Goto MAP
- If XM>9 and XM<33 and YM>72 and YM<80 Then TEMP=11 : Rem push
- If TEMP=0
- Bell : Print "There is nothing of interest here."
- Else If TEMP=7
- Print "Pick up what?" : Gosub MICE1
- X1=0 : Rem indentify object
- For Y1=4 To 32
- If ROOM=FLAG(Y1)
- X1=Y1
- End If
- Next
- If X1>0 and XM>200 and XM<240 and YM>100 and YM<140 and FLAG(X1)=ROOM
- FLAG(X1)=0 : Bob Off X1 : Wait Vbl : OBJECTS(X1)=OBJECTS(X1)+1
- Print "You pick up the ";OBJECT$(X1) : SCORE=SCORE+10
- Else
- Print "There is nothing to get here."
- End If
- Else If TEMP=8
- Rem gosub tools
- Print "Put down what?"
- Else If TEMP=9
- If MAP(3,1)=1 and OBJECTS(19)>0
- OBJECTS(19)=OBJECTS(19)-1
- Paste Bob 120,80,38 : KEYFLAG=1
- Else
- Print "Use what item?"
- End If
- Else If TEMP=10
- 'Not in effect for demo
- Print "Look at what?" : Gosub MICE1
- MICE3:
- X1=0 : Rem indenify object
- For Y1=4 To 32
- If ROOM=FLAG(Y1)
- X1=Y1
- End If
- Next
- If X>0 and XM>200 and XM<240 and YM>100 and YM<140
- Print "You are looking at a ";OBJECT$(X1)
- Else
- Rem gosub tools if look is flagged again
- Print "There is nothing special here."
- End If
- Else If TEMP=11
- Print "Nothing happens."
- End If
- Return
-
- MAIN:
- Do
- If NS<>N Then Gosub LANDSCAPES
- Gosub MICE
- If ROBOFLAG>2 Then Exit
- Loop
- Print "You have been arrested by the robocop" : Wait 120
- Erase All
- End
-
- INFORMATION:
- 'Map key Color values
- '0 = Walls, You can't go through them.
- '1 = Door requires key to open
- '2 = Key located here
- '3 = Passageways, nothing special here
- '4 = Teleport or Master Control, not used
- '5 = Robo Control Computer, not used
- '6 = Robocop Zone, A robocop shows up to block your way
- '7 = Explored Area visible on game map.
- ' Colors 1-6 are set to black as to remain invisible until you go there.
- 'Then, they are replace by color 7.
- Screen Open 0,640,200,2,Hires:Rem Open a text screen
- Curs Off : Flash Off
- Screen Open 2,320,200,8,Lowres:Rem Open the map screen, load map.
- Curs Off : Flash Off
- Load Iff "Map1"
- Palette ,0,0,0,0,0,0
- Screen Open 1,320,200,32,Lowres:Rem Open display screen
- Load Iff "Default"
- D$(1)="north." : D$(2)="east." : D$(3)="south." : D$(4)="west."
- Load "objects.abk":Rem Mostly stuff for projected game
- For X1=4 To 17
- OBJECTS(X1)=1
- Next
- For X1=18 To 34
- OBJECTS(X1)=0
- Next
- OBJECTS(20)=1
- For X1=1 To 34
- FLAG(X1)=0
- Next
- OBJECT$(1)="direction"
- OBJECT$(2)="Robocop"
- OBJECT$(3)="Burned out Robocop"
- OBJECT$(4)="stun gun"
- OBJECT$(5)="flashlight"
- OBJECT$(6)="tool box"
- OBJECT$(7)="remote"
- OBJECT$(8)="power pack"
- OBJECT$(9)="food module"
- OBJECT$(10)="water jug"
- OBJECT$(11)="gas mask"
- OBJECT$(12)="knife"
- OBJECT$(13)="blanket"
- OBJECT$(14)="clothes"
- OBJECT$(15)="book"
- OBJECT$(16)="note"
- OBJECT$(17)="tote cart"
- OBJECT$(18)="stone"
- OBJECT$(19)="key"
- OBJECT$(20)="chain mail"
- OBJECT$(21)="G"
- OBJECT$(22)="R"
-
- N=2 : X=5 : Y=5 : Z=1 : NS=0
- ROBOFLAG=1 : ROBOCOP=0 : MAPOBJ=1
- Paper 0 : Pen 1
- Goto MAIN
-